package com.pactera.integral.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pactera.integral.common.repository.QueryResult;
import com.pactera.integral.common.repository.ResultMap;
import com.pactera.integral.common.web.GenericController;
import com.pactera.integral.common.web.Response;
import com.pactera.integral.entity.UserAdditionalScore;
import com.pactera.integral.service.UserAdditonalScoreService;

@Controller
@RequestMapping("adm/userAuditScore")
public class UserAuditScoresController extends GenericController {

	@Autowired
	private UserAdditonalScoreService userAdditionalScoreService;

	/**
	 * 用户积分终审列表
	 * 
	 * @param param
	 * @param pageable
	 * @return Response
	 */
	@PostMapping("/page")
	@ResponseBody  
    public Response searchAdditionalScore(@RequestBody HashMap<String,Object> param, Pageable pageable) {
    	QueryResult<ResultMap<String, Object>> queryResult = userAdditionalScoreService.searchAdditionalScore(param, pageable);
    	
    	return this.normal(queryResult); 
    }
	
	/**
	 * 用户积分终审明细列表.
	 * @param param
	 * @param pageable
	 * @return Response
	 */
	@PostMapping("/additionalScoreDetailed")
	@ResponseBody  
    public Response additionalScoreDetailed(@RequestBody HashMap<String,Object> param, Pageable pageable) {
		
    	QueryResult<ResultMap<String, Object>> queryResult = userAdditionalScoreService.searchAdditionalScoreDetailed(param,pageable);
    	
    	return this.normal(queryResult); 
    }
	
	/**
	 * 修改终审积分
	 * @param userAdditionalScore
	 * @return Response
	 */
	@RequestMapping(value = "/updateAuditScore", method = RequestMethod.POST)
	@ResponseBody
	public Response updateAuditScore(@RequestBody UserAdditionalScore userAdditionalScore) {
		
		return this.normal(userAdditionalScoreService.updateAuditScore(userAdditionalScore));
	}
	
	/**
	 * 积分终审明细
	 * @param param
	 * @param pageable
	 * @return Response
	 */
	@PostMapping("/searchAuditScoreDetailed")
	@ResponseBody  
    public Response searchAuditScoreDetailed(@RequestBody HashMap<String,Object> param, Pageable pageable) {
		
    	QueryResult<ResultMap<String, Object>> queryResult = userAdditionalScoreService.searchAuditScoreDetailed(param, pageable);
    	
    	return this.normal(queryResult); 
    }
}
